package edu.columbia.plt.visage;

import java.awt.Color;


/* Main function
 * 
 * 
 */

public class App {
	
	public void run() throws InterruptedException {
			// code header
Matrix matrix = new Matrix(40, 40, 10);
for (int i = 0; i < 1; i++) {
AgentDriver agent = new AgentDriver("h2");
{
agent.changeColor(Color.yellow);
agent.setSpeed(0.1);
}
Thread t = new Thread(agent);
t.start();
}
for (int i = 0; i < 1; i++) {
AgentDriver agent = new AgentDriver("f2");
{
agent.changeColor(Color.red);
agent.setSpeed(0.1);
}
Thread t = new Thread(agent);
t.start();
}
for (int i = 0; i < 20; i++) {
AgentDriver agent = new AgentDriver("hf");
{
agent.changeColor(Color.pink);
agent.setSpeed(0.5);
}
Thread t = new Thread(agent);
t.start();
}
Plot plot = new Plot();
MatrixDraw matrixDraw = new MatrixDraw("Visage Simulation", matrix.getMatrixWidthInPixels(), matrix.getMatrixHeightInPixels());
while (true) {
matrixDraw.redraw(matrix);
plot.plot("0", Matrix.getAgentSetByType("h2").size());
plot.plot("1", Matrix.getAgentSetByType("f2").size());
plot.plot("2", Matrix.getAgentSetByType("hf").size());
plot.plot("3", (Matrix.getAgentSetByType("h2").size()+Matrix.getAgentSetByType("f2").size()+Matrix.getAgentSetByType("hf").size())/3);
Thread.sleep(100);
}

		
		
		
		
		
		// code footer
	}
	public static void main(String args[]) throws InterruptedException {
		
		App visageApp = new App();
		visageApp.run();


	}
}
/*
 * pseudo code: draw Panel; while(condition){ wait for input; //input source
 * code compile(); //compile source code //initial New Matrix; // for(;N;) new
 * Thead(new Agent);//fork N agents New Pan; New Thead(new Plot); //if plot on
 * 
 * //loop wait for signal to run //start loop while(condition2){ handle mouse,
 * keyboard logic here; //? I am not so sure wait for signal to stop or pause
 * //pause or kill all threads } }
 * 
 * 
 * //void compile(){};
 */

